<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <!-- <script src="http://localhost:8080"></script> -->
    <!-- 引入react核心库 -->
    <script type="text/javascript" src="../../js/react.development.js"></script>
    <!-- 用于支持react操作DOM -->
    <script type="text/javascript" src="../../js/react-dom.development.js"></script>
    <!-- 用于将jsx转为js -->
    <script type="text/javascript" src="../../js/babel.min.js"></script>
</head>
<body>
    <script type="text/babel">
        class Person{
            // 构造器
            constructor(name, age){
                this.name = name
                this.age = age
            }
            // 方法
            speak(){
                console.log(`myName:${this.name}, myAge:${this.age}`);
            }
        }
        const p1 = new Person("rollingball","18")
        const p2 = new Person("bollu","3")
        // console.log(p1);
        p1.speak()
        p2.speak()

        class Student extends Person{
            // 构造器
            constructor(name, age, grade){
                super(name,age)
                this.grade = grade
            }
            // 方法
            speak(){
                console.log(`myName:${this.name}, myAge:${this.age}, myGrade:${this.grade}`);
            }
        }
        const s1 = new Student("sb", "19", "1")
        s1.speak()
    </script>
</body>
<style>
</style>
</html>